package cn.nfwx.tv.db;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

@Dao
public interface DownProgramDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long insert(DownProgramModel programModel);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long[] insert(DownProgramModel... programModels);

    @Update
    void update(DownProgramModel... programModels);

    @Delete
    void delete(DownProgramModel... programModels);

    @Query("SELECT * FROM tb_program")
    List<DownProgramModel> queryForAll();

    @Query("select * from tb_program where downloadUrl = :downloadUrl")
    List<DownProgramModel> queryAllByUrl(String downloadUrl);
}
